import http from "@/api";

import { ResPage } from "@/api/interface";
import { CommonTree, OptionVo } from "@/biz/interface";

import { JobVo, OddJobEntity } from "@/biz/interface/JobType";

import { ModuleMainUrl } from "..";

const moduleUrl = ModuleMainUrl;

// * 获取发布的岗位列表
export const getJobVoListApi = (params: {}) => {
  return http.post<ResPage<JobVo>>(moduleUrl + `/cpyjob/trainvolist`, params);
};

// * 获取培训公司列表
export const getTrainCompanyVoListApi = (params: {}) => {
  return http.post<OptionVo>(moduleUrl + `/cpy/traincpydropvo`, params);
};

// * 获取 培训考证 类型列表
export const getTrainTypesTreeApi = (params: {}) => {
  return http.post<CommonTree>(moduleUrl + `/job/tttree`, params);
};

// * 新增发布的岗位接口
export const saveJobApi = (job: OddJobEntity) => {
  return http.post(moduleUrl + `/cpyjob/trainsave`, job);
};

// * 详情发布的岗位接口
export const getJobInfoApi = (params: { id: string }) => {
  return http.post<OddJobEntity>(moduleUrl + `/cpyjob/traininfo`, params);
};

// * 获取下一个要审核的考证岗位
export const getNextJobApi = (params: { id: string }) => {
  return http.post(moduleUrl + `/cpyjob/trainrpnextitem`, params);
};

// * 删除发布的岗位接口
export const deleteJobApi = (params: { id: string }) => {
  return http.post(moduleUrl + `/cpyjob/traindelete`, params);
};

// * 正在招聘中的岗位下架
export const setJobOffline = (params: { id: string }) => {
  return http.post(moduleUrl + `/cpyjob/trainoffline`, params);
};
